import axios from 'axios'
axios.defaults.withCredentials = true;
axios.defaults.crossDomain = true;
axios.defaults.timeout = 5000;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
import { Loading } from 'element-ui';
let loadingInstance = Loading.service({fullscreen: true});
export default{
  get: function(url){
    return new Promise((resolve,reject)=>{
      axios.get(url).then(res=>{
        if(res.data.code == 200)
        {
          loadingInstance.close();
          resolve(res.data);
        } 
      },err=>{
        reject('请求失败')
      })
    })
  }
}